<template>

    <t-dialog
        v-model:visible="dialogVisible"
        :header="title"
        :body="content"
        confirm-btn="确定"
        cancel-btn="取消"
        :on-confirm="onConfirm"
        :on-close="onClose"
      />

</template>

<script setup lang="jsx">
import { ref,watch } from 'vue';

const props = defineProps({
    visible:{
        type:Boolean,
        default:false
    },
    title:{
        type:String,
        default:''
    },
    content:{
        type:String,
        default:''
    }
})

const dialogVisible = ref(false)
watch(()=>props.visible, (newValue)=>{
    dialogVisible.value = newValue
})
//声明父组件传递过来的方法
const emit = defineEmits(['close', 'confirm'])

const onConfirm = ()=>{
    emit('confirm')
}
const onClose = ()=>{
   emit('close')
}

</script>